import { Inject, Provide } from '@midwayjs/core';
import { BaseService } from '@cool-midway/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
import { OrderOrderEntity } from '../entity/order';
import { NurseInfoEntity } from '../../nurse/entity/info';
/**
 * 订单信息
 */
@Provide()
export class OrderOrderService extends BaseService {
  @InjectEntityModel(OrderOrderEntity)
  orderOrderEntity: Repository<OrderOrderEntity>;

  @InjectEntityModel(NurseInfoEntity)
  nurseInfoEntity: Repository<NurseInfoEntity>;


  async updateOrderNursing(BodyData) {
    let data = await this.orderOrderEntity.update({
      id: BodyData.id
    }, { nurseId: BodyData.nurseId })
    await this.nurseInfoEntity.update({
      id: Number(BodyData.nurseId)
    }, {
      status: 1
    })
    return data
  }
}
